Docker if you need to edit file on stopped docker

I had a problem with a container which wouldn’t start due to a bad config change I made. I was able to copy the file out of the stopped container and edit it. something like:

docker cp test-mysql:/etc/mysql/my.cnf .

Edit it and copy back

docker cp my.cnf test-mysql:/etc/mysql/my.cnf
docker start mysql
docker exec -ti mysql bash

Leave a Reply